package com.iplant.aps.service;

import com.iplant.aps.service.apsenum.aps.APSShiftPeriod;
import com.iplant.aps.service.po.aps.*;
import com.iplant.aps.service.po.aps.dayPlan.APSTaskPartPointDayParent;
import com.iplant.aps.service.po.aps.impPo.APSMonthShowPo;
import com.iplant.aps.service.po.oms.OMSOrder;
import com.iplant.aps.service.po.oms.OMSOutsourceOrder;
import com.iplant.aps.service.po.sch.APSMessage;
import com.iplant.base.po.Pagination;
import com.iplant.base.po.ServiceResult;
import com.iplant.base.po.excel.ExcelData;
import com.iplant.basic.service.po.bms.BMSEmployee;
import com.iplant.pdm.service.po.bop.FPCRoutePart;

import java.util.Calendar;
import java.util.List;
import java.util.Map;

public interface APSService {

    //region 计划排程

    ServiceResult<List<APSTaskPart>> APS_ScheduleTaskPart(BMSEmployee wLoginUser, List<OMSOrder> wOMSOrderList,
                                                          Calendar wStartDate, Calendar wEndDate);

    ServiceResult<List<Map<String, Object>>> APS_QueryTableInfoList(BMSEmployee wLoginUser, Calendar wStartTime,
                                                                    Calendar wEndTime, int wAPSShiftPeriod);

    ServiceResult<List<APSTaskPart>> APS_AutoTaskPart(BMSEmployee wLoginUser, List<OMSOrder> wOrderList,
                                                      APSShiftPeriod wShiftPeriod, int wAllowTechDelayHour,
                                                      boolean wCheckMaterialBool, Calendar wStartTime,
                                                      Calendar wEndTime);


    ServiceResult<List<APSMessage>> APS_CheckTaskPart(BMSEmployee wLoginUser, List<OMSOrder> wOrderList,
                                                      List<APSTaskPart> wCheckTaskList, APSShiftPeriod wShiftPeriod,
                                                      List<APSTaskPart> wOrderPartIssuedList,
                                                      List<OMSOutsourceOrder> wOutsourceOrderList,
                                                      Calendar wStartTime, Calendar wEndTime,
                                                      Map<Integer, List<FPCRoutePart>> wRoutePartList,
                                                      List<APSManuCapacity> wManuCapacityList, int wWorkDay);

    ServiceResult<Integer> APS_SaveTaskPartList(BMSEmployee wLoginUser, Calendar wStartTime, Calendar wEndTime,
                                                List<APSTaskPart> wTaskPartList, List<APSMessage> wMessageList);
    //endregion

    //region 订单管理
    ServiceResult<Integer> OMS_ImportOrder(BMSEmployee wLoginUser, ExcelData wExcelData);

    ServiceResult<Integer> OMS_CompleteProcess(BMSEmployee wLoginUser, OMSOrder wOMSOrder);

    ServiceResult<Integer> OMS_StatusSet(BMSEmployee wLoginUser, OMSOrder wOMSOrder, int wStatus);

    ServiceResult<Integer> OMS_UpdateOrder(BMSEmployee wLoginUser, OMSOrder wOMSOrder);
    //endregion

    //region 日计划
    ServiceResult<List<APSTaskPartPointDay>> APS_QueryDayPlan(BMSEmployee wLoginUser, Map<String, Object> wParams, Calendar wDate, Pagination wPagination);

    ServiceResult<List<APSTaskPartPointDayParent>> APS_QueryDayPlanParent(BMSEmployee wLoginUser, Map<String, Object> wParams, Calendar wDate, Pagination wPagination);

    ServiceResult<List<APSTaskPartPointDayParent>> APS_QueryDispatchList(BMSEmployee wLoginUser, Map<String, Object> wParams, Pagination wPagination);

    ServiceResult<List<APSTaskPartPointDay>> APS_QueryTaskPartPointDayAll(BMSEmployee wLoginUser, Map<String, Object> wParams, Pagination wPagination);

    ServiceResult<List<APSTaskPartPointDay>> APS_QueryToDispatchList(BMSEmployee wLoginUser, Map<String, Object> wParams, Pagination wPagination);
    ServiceResult<List<APSTaskPartPointDay>> APS_CreateDayPlan(BMSEmployee wLoginUser, int wTaskPartPointID, Calendar wDate);
    ServiceResult<List<APSTaskPartPointDayParent>> APS_QueryDayPlanParent_V1(BMSEmployee wLoginUser, Map<String, Object> wParams, Calendar wDate, Pagination wPagination);

    ServiceResult<Integer> APS_AutoCompleteDailyPlan(BMSEmployee wLoginUser);

    ServiceResult<Integer> APS_TriggerAutoCompleteTomorrowLogic(BMSEmployee wLoginUser, List<APSTaskPartPointDay> wAPSTaskPartPointDayList);
    //endregion

    //region 计划相关

    ServiceResult<Integer> APS_MonthlyPlanImport(BMSEmployee wLoginUser, ExcelData result);

    ServiceResult<Integer> APS_QueryGanttData(BMSEmployee wLoginUser, List<APSTaskPart> wAPSTaskPartList);

    ServiceResult<Integer> APS_WeeklyPlanImport(BMSEmployee wLoginUser, ExcelData result);

    ServiceResult<List<APSMonthShowPo>> APS_QueryMonthDataChangeToShow(BMSEmployee wLoginUser, int wSchedulingVersionBPMID);

    ServiceResult<Integer> APS_ResetFirstCheckStatus(BMSEmployee wLoginUser, int wDayTaskID);

    ServiceResult<List<OMSOrder>> OMS_QueryOrderAll(BMSEmployee wLoginUser, Map<String, Object> wParams, Pagination wPagination);
    //endregion
}
